/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/09/16
*/
#ifndef __EDUI_SLIDER_H__
#define __EDUI_SLIDER_H__

#include "Progress.h"

EDUI_NAMESPACE_BEGIN

class EDUI_API Slider : public Progress
{
public:
    struct {
        Event1<Slider*> progress;
    } evt;
protected:
    Slider();
    virtual ~Slider();
public:
	static Slider* GetInterface();
	virtual void Release();
    static Slider* ToSlider(Control* ctrl);
public:
    virtual bool  SetRect(const Rect *rc);
    
    void SetThumbSize(int w, int h);
    Size GetThumbSize();

    virtual Rect GetThumbRect();
    virtual Rect GetBarRect();

    void SetStep(int step);
    int GetStep() const;

    virtual bool SetValue(int val);
protected:
    virtual bool HandleMsg(Msg* msg);
    virtual void RenderStatusImages(IRender* render, const Rect* rc);

    virtual void SetAttribute(const char* name, const char* value);
    virtual ImageData* GetDestImageData(const char* dstname);
    virtual void DoEvent(EventType type, void* data1 = 0, void* data2 = 0);

    void ThumbMove(int x, int y);
protected:
    ImageData m_thumbNoramlImage;
    ImageData m_thumbHotImage;
    ImageData m_thumbPressedImage;
    ImageData m_thumbDisabledImage;

    ButtonState m_thumbState;

    Size m_thumbSize;
    Point m_thumbPt;
    int m_step;
    bool m_mouseMove;
};

EDUI_NAMESPACE_END

#endif
